import {createWebHistory,createRouter} from "vue-router";
import index from '../view/index.vue'
import Guide from "@/view/index/Guide.vue";
import Visitor from "@/view/index/Visitor.vue";
import Manager from "@/view/index/Manager.vue";
import GuideProfile from '@/view/GuideProfile.vue'
import VisitorProfile from '@/view/VisitorProfile.vue'

// 游客子页面
import VisitorProfileInfo from '@/view/visitor/Profile.vue'
import VisitorBooking from '@/view/visitor/Booking.vue'

// 地陪子页面
import GuideProfileInfo from '@/view/guide/Profile.vue'
import GuideWork from '@/view/guide/Work.vue'

import Login from "@/view/Login.vue";
import Main from "@/view/index/main.vue";
import Transaction from "@/view/index/Transaction.vue";
import ManagerProfileInfo from '@/view/index/Profile.vue'
import GuideMain from "@/view/guide/guideMain.vue";
import VisitorMain from "@/view/visitor/visitorMain.vue";


//定义路由
const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/guide/profile',
    name: 'GuideProfile',
    component: GuideProfile,
    meta: { userType: 'guide' },
    children: [
      {
        path: '/guideMain',
        name: 'GuideMain',
        component: GuideMain
      },
      {
        path: '/guide/profile',
        name: 'GuideProfileInfo',
        component: GuideProfileInfo
      },
      {
        path: '/guide/work',
        name: 'GuideWork',
        component: GuideWork
      },
    ]
  },
  {
    path: '/visitor/profile',
    name: 'VisitorProfile',
    component: VisitorProfile,
    meta: { userType: 'visitor' },
    children: [
      {
        path: '/visitorMain',
        name: 'VisitorMain',
        component: VisitorMain
      },
      {
        path: '/visitor/profile',
        name: 'VisitorProfileInfo',
        component: VisitorProfileInfo
      },
      {
        path: '/visitor/booking',
        name: 'VisitorBooking',
        component: VisitorBooking
      }
    ]
  },
  {
    path: '/',
    name: 'index',
    component: index,
    //redirect: '/manager',
    children: [
      {
        path: '/manager/profile',
        name: 'ManagerProfileInfo',
        component: ManagerProfileInfo
      },
      {
        path: '/main',
        name: 'Main',
        component: Main
      },
      {
        path: '/guide',
        name: 'Guide',
        component: Guide
      },
      {
        path: '/visitor',
        name: 'Visitor',
        component: Visitor
      },
      {
        path: '/manager',
        name: 'Manager',
        component: Manager
      },
      {
        path: '/transaction',
        name: 'Transaction',
        component: Transaction
      },
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})
export default router;